package com.coderdream.chapter06.prototype.real;

import com.coderdream.chapter06.prototype.framework.Product;

public class MessageBox  implements Product {

	private char decochar;
	
	public MessageBox(char decochar) {
		this.decochar = decochar;
	}
	
	public Product createClone() {
		Product p = null;
		
		try {
			p = (Product)clone();
		} catch (CloneNotSupportedException e) {
			e.printStackTrace();
		}
		
		
		return p;
	}

	public void use(String s) {
		int length = s.getBytes().length;
		
		for (int i = 0; i < length + 4; i++) {
			System.out.print(this.decochar);
		}
		
		System.out.println("");
		System.out.println(this.decochar + " " + s + " " + decochar);
		
		for (int i = 0; i < length + 4; i++) {
			System.out.print(this.decochar);
		}
		
		System.out.println("");		
	}

}
